<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style>
    </style>


</head>

<body class="white-bg" style="padding: 3px;">
<div class="page-heade">
       <h2 class="title_color text-center">待审批网点提醒管理</h2>
    </div>
    <form action="" class="form-group" id="form1">
        <table class="table table-bordered white-bg">
            <tr>
                <td colspan="2">
                    <button class="btn btn-primary addAprolvalWarn">新增</button>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"><label for="Name">姓名：</label></td>
                <td><input type="text" class="form-control inputremindPeple" id="Name" name="Name" style="width: 160px"></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;"> <button class="btn btn-info">查询</button> <button class="btn btn-info emtyif" id="reset">清空查询条件</button></td>
            </tr>
        </table>

    </form>

    <div class="padding-10">
        <form action="#" method="get" id="form_approvalSystem">

        <table class="table table-striped table-bordered table-hover bud_hei text-center aprovalSystemTable">

            <thead>
                <tr class="info">
                    <th class="text-center">No.</th>
                    <th class="text-center">被提醒员工</th>
                    <th class="text-center">提醒方式</th>
                    <th class="text-center">操作</th>
                </tr>
            </thead>
            <tbody>
                {volist name="data" id="row" key="k"}
                <tr class="angency_tableInfo">
                    <td class="NoId">{$k}</td>
                    <td>中尉</td>
                    <td>弹窗、邮件</td>
                    <td><a href="javascript:;" class="del_this">删除</a></td>
                </tr>
                {/volist}
            </tbody>
        </table>

        </form>
        <div class="col-md-12 white-bg" style="padding: 20px 0;text-align: center;">
            {$page}
        </div>
    </div>

<!-- 全局js -->
{include file="Public/footer"}
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
<script>
    /*操作表格复选框*/
    $(document).ready(function(){

        /*批量审批*/
        $(".allApraval").click(function(){
            var $items = $("[name=items]:checkbox")

            if ($items.filter(':checked').length < 1) {
                sweetAlert("", "请选择要审批的系统！", "error");
            } else {
                // $("#alert_addNewZone").show();
                // 要审批的内容
            }
        })
        /*显示明细*/
        $(".showDetail").click(function(){
            layer.open({
                type: 2,
                title: '系统详情',
                shadeClose: true,
                shade: 0.3,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: 'http://localhost/xiaolutong/xiaolutong/system/systemDetail.html'
            })
        });

        /*设置提醒人*/
        $(".setRemindPeople").click(function() {
            layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: 0.3,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '600px'],
                content: 'http://localhost/xiaolutong/xiaolutong/system/setRemindPeople.html'
            })
        });
    });
</script>

<script>
    $(document).ready(function () {
        $(".angency_tableInfo>td>.netNameA").click(function() {
            $(this).parents("tr").next(".this_tableInfo_alert").toggle().siblings(".this_tableInfo_alert").hide();
            $(this).parents("tr").addClass("trBackgroundColor").siblings("tr").removeClass("trBackgroundColor");
        })

        $("#moreQueryIf").click(function(){
            $(this).parent().parent().hide()
            $("#moreTable").show()
            return false
        })
        $("#packQueryIf").click(function(){
            $("#moreTable").hide();
            $("#moreQueryIf").parent().parent().show();
            return false
        })


        $('.del').on('click',function(){
            var arr = []
            $('input[name=items]:checked').each(function(i,o){
                arr.push($(o).val())
            })
            arr = arr.join(',')
            $.post('{:url("batchDelete")}',{ids:arr},function(data){
                if(data.success){
                    location.reload()
                }else{
                    swal(data.msg,'','warning')
                }
            },'json')
        })
        //清除查询条件
        $('#reset').on('click',function () {
            $("#form1 input").each(function(){
                $(this).val('');
            });
            $("#form1 select").each(function(){
                $(this).val('');
            });
            $('#form1').submit()
            return false
        })
        //增加
        $(".addAprolvalWarn").click(function () {
            layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '600px'],
                content: '{:url("add")}'
            })
            return false
        });
        //回收站
        $("#isdel").click(function () {
            var index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '600px'],
                content: '{:url("isdel")}'
            })
            layer.full(index)
            return false
        });

        /*tabel复选框操作*/
        $("#checkAll").click(function() {

            $("[name=items]:checkbox").prop("checked", $(this).prop("checked"));
            if ($("[name=items]:checkbox").prop("checked") != true) {
                // console.log($(this))
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#fff")
            } else {
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#f8f800")

            }
        })
        $("[name=items]:checkbox").click(function() {
            //定义一个临时变量，避免重复使用同一个选择器选择页面中的元素，提高程序效率
            // console.log(1)
            var $tmp = $("[name=items]:checkbox");
            if ($(this).prop("checked") != true) {
                // console.log($(this))
                $(this).parent().parent().css("backgroundColor", "#fff")
            } else {
                $(this).parent().parent().css("backgroundColor", "#f8f800")

            }
            //用filter()方法筛选出选中的复选框，并直接给CheckedAll赋值
            $("#checkAll").prop('checked', $tmp.length == $tmp.filter(':checked').length);

        })

        //修改
        $(".xiugai").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            layer.full(index)
            return false
        });
        //维护系统
        $(".whSystem").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            layer.full(index)
            return false
        });
        //维护分组货号
        $(".whproductAR").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            layer.full(index)
            return false
        });
        //替换
        $(".tihuan").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            return false
        });
        //追加
        $(".zhuijia").click(function () {
            var link = $(this).attr('href')
            index = layer.open({
                type: 2,
                title: '&nbsp;',
                shadeClose: true,
                shade: false,
                maxmin: true, //开启最大化最小化按钮
                area: ['800px', '500px'],
                content: link
            })
            return false
        });
        //停止供货
        $('.stopAfford').click(function () {
            var link = $(this).attr('href')
            swal({
                title: "您确定删除吗",
                text: "",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定",
                closeOnConfirm: false
            }, function (isConfirm) {
                if(isConfirm){
                    $.ajax({
                        'type':'post',
                        'url':link,
                        'dataType':'json',
                        'success':function (data) {
                            if(data.success){
                                location.reload()
                            }else
                                swal(data.msg, "", "error");
                        }
                    })
                }

            });
            return false
        });
    })
</script>
</body>

</html>